import triton

compiled_kernel_list = {}

def triton_helper_compile(func, signature, constants=None):
    assert func, "func must not be 'None"

    if constants is not None:
        ast = triton.compiler.ASTSource(fn=func, signature=signature, constants=constants)
    else:
        ast = triton.compiler.ASTSource(fn=func, signature=signature)

    options = {
        "num_warp": 2,
        "num_stages": 0
    }

    target = triton.backends.compiler.GPUTarget("npu", 80, 80)
    kernel = triton.compile(ast, target=target, options=options)
